﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master"Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Areas.Manage.Models.User.Manage_DetailModel>" %>

<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    用户详情
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>用户详情</legend>
        <% Html.BeginForm(); %>
        <ul class=" editlist">
            <%var detail = Model.Detail ?? new QianBuo.Lottery.Web.Areas.Manage.Models.User.Manage_UserDetail();
              var account = Model.Accout ?? new Account();
            %>
            <li>
                <label class="label">
                    登录名:</label><%=Html.TextBoxFor(p=>p.Detail.LoginName) %><%=Html.ValidationMessageFor(p=>p.Detail.LoginName,"请输入当前用户的登录名") %></li>
            <li>
                <label class="label">
                    直实姓名:</label><%=Html.TextBoxFor(p=>p.Detail.Name) %><%=Html.ValidationMessageFor(p=>p.Detail.Name,"请输入当前用户的真实姓名") %></li>
            <li>
                <label class="label">
                    登录密码:</label><input type="password" name="LoginPwd" value="LoginPwd" /><%=Html.ValidationMessageFor(p=>p.LoginPwd) %>(6-12位任意字符)</li>
            <li>
                <label class="label">
                    提款密码:</label><input type="password" name="TakePwd" value="TakePwd" /><%=Html.ValidationMessageFor(p=>p.TakePwd) %>(6-12位任意字符)</li>
            <li>
                <label class="label">
                    用户状态:</label><span class="spans">
                        <%=Html.RadioButtonFor(p=>p.Detail.State,(short)UserState.Normal)%><%=UserState.Normal.GetName() %>
                        <%=Html.RadioButtonFor(p=>p.Detail.State,(short)UserState.Freez)%><%=UserState.Freez.GetName() %>
                        <%=Html.RadioButtonFor(p=>p.Detail.State,(short)UserState.Locked_Manage)%><%=UserState.Locked_Manage.GetName() %>
                        <%=Html.RadioButtonFor(p=>p.Detail.State,(short)UserState.Locked)%><%=UserState.Locked.GetName() %>
                        <%=Html.ValidationMessageFor(p=>p.Detail.State,"请选择当前用户的状态") %></span></li>
            <li>
                <label class="label">
                    类型:</label><span class="spans">
                        <%=Html.RadioButtonFor(p=>p.Detail.UserType,(short)UserType.Member) %><%=UserType.Member.GetName() %>
                        <%=Html.RadioButtonFor(p=>p.Detail.UserType,(short)UserType.Surrogate) %><%=UserType.Surrogate.GetName() %>
                        <%=Html.ValidationMessageFor(p=>p.Detail.UserType,"请选择当前用户的类型") %>
                        <font size='1'>(更改用户类型时,如果当前用户有直属下级则将会转移到当前用户的直属上级代理名下)</font></span>
            </li>
            <li>
                <label class="label">
                    银行信息状态:</label>
                <span class="spans">
                    <%=Html.RadioButtonFor(p=>p.Detail.Locked,true) %>锁定
                    <%=Html.RadioButtonFor(p=>p.Detail.Locked,false) %>未锁定 </span></li>
            <li>
                <label class="label">
                    注册时间:</label><%=Model.RegestTime %><%=Html.HiddenFor(p=>p.RegestTime) %></li>
            <li>
                <label class="label">
                    银行卡号:</label><%=Html.TextBoxFor(p=>p.Detail.BankCardNo) %><%=Html.ValidationMessageFor(p=>p.Detail.BankCardNo) %></li>
            <li>
                <label class="label">
                    银行名称:</label><%Html.RenderAction("Bank", "Commen", new { area = "", id = Model.Detail.BankID, controlName = "Detail.BankID" });%><%=Html.ValidationMessageFor(p=>p.Detail.BankID) %></li>
            <li>
                <label class="label">
                    开户城市:</label><span class="spans"><%Html.RenderAction("City", "Commen", new { area = "", id = Model.Detail.BankCityID, colname = "Detail.BankCityID" }); %><%=Html.ValidationMessageFor(p=>p.Detail.BankCityID) %></span></li>
            <li>
                <label class="label">
                    银行详情/街道:</label><span class="spans"><%=Html.TextBoxFor(p=>p.Detail.BankStreetName) %><%=Html.ValidationMessageFor(p=>p.Detail.BankStreetName) %></span></li>
            <li>
                <label class="label">
                    网上支付账号:</label><span class="spans"><%=Html.TextBoxFor(p => p.Detail.PayAccount)%><%=Html.ValidationMessageFor(p => p.Detail.PayAccount)%>
                        请写明支付名称和账号，如:财付通 123456</span></li>
            <li>
                <label class="label">
                    邮箱:</label><%=Html.TextBoxFor(p=>p.Detail.Email) %><%=Html.ValidationMessageFor(p=>p.Detail.Email) %></li>
            <li>
                <label class="label">
                    QQ:</label><%=Html.TextBoxFor(p=>p.Detail.QQ) %><%=Html.ValidationMessageFor(p=>p.Detail.QQ) %></li>
            <li>
                <label class="label">
                    电话:</label><%=Html.TextBoxFor(p=>p.Detail.Tel) %><%=Html.ValidationMessageFor(p=>p.Detail.Tel) %></li>
            <li>
                <label class="label">
                    总充值金额:</label>
                <label class="lbl">
                    <%=(double)account.AddMoney%></label>
                <label class="label">
                    余额:</label>
                <label class="lbl lblbalance_Manage_Detail">
                    <%=(double)account.Balance%></label>
                <label class="lbl">
                    <input value="<%=(double)account.Balance %>" class="txtbalance_Manage_Detail" style="display: none;" />
                    <%=Html.ValidationMessage("NewBalance")%>
                </label>
                <label class="label">
                    冻结金额:</label>
                <label class="lbl lblfreezeMoney_Manage_Detail">
                    <%=(double)account.FreezeMoney%></label>
                <label class="lbl">
                    <input value="<%=(double)account.FreezeMoney%>" class="txtfreezeMoney_Manage_Detail"
                        style="display: none;" />
                    <%=Html.ValidationMessage("NewFreezeMoney")%>
                </label>
                <label class="lblbtn">
                    <label class="">
                        <a class="a_blue link_update" onclick="link_update_Click(this)">修改</a> <a class="a_blue link_save"
                            onclick="link_save_Click(this)" style="display: none;">保存</a> <a class="a_blue link_cancel"
                                onclick="link_cancel_Click(this)" style="display: none;">取消</a>
                    </label>
                </label>
            </li>
            <li>
                <label class="label">
                    总返点金额:</label><label class="lbl"><%=(double)account.BackMoney%></label>
                <label class="label">
                    总购彩金额:</label><label class="lbl"><%=(double)account.BuyLottery%></label>
                <label class="label">
                    总提款金额:</label><label class="lbl"><%=(double)account.TackMoney%></label>
            </li>
            <li>
                <label class="label">
                    总下级返点金额:</label><label class="lbl"><%=(double)account.BackMoney_Child%></label>
                <label class="label">
                    总中奖金额:</label><label class="lbl"><%=(double)account.WinMoney%></label>
                <label class="label">
                    总下级返奖金额:</label><label class="lbl"><%=(double)account.WinMoney_Child%></label>
            </li>
            <li class="btn">
                <input type="submit" value="保存" onclick="javascript:return confirm('您确定要保存?');" /></li>
        </ul>
        <% if (Request["returnUrl"] != null)
           { %>
        <a href='<%=Request["returnUrl"] %>' class="a_blue">返回>></a>
        <%} %>
        <%=Html.HiddenFor(p=>p.Uid) %>
        <%=Html.HiddenFor(p => p.OldDetail.BankCardNo)%>
        <%=Html.HiddenFor(p => p.OldDetail.Email)%>
        <%=Html.HiddenFor(p => p.OldDetail.UserType)%>
        <%=Html.HiddenFor(p=>p.OldDetail.BankCityID)%>
        <%=Html.HiddenFor(p=>p.OldDetail.BankID)%>
        <%=Html.HiddenFor(p=>p.OldDetail.BankStreetName)%>
        <%=Html.HiddenFor(p=>p.OldDetail.Locked)%>
        <%=Html.HiddenFor(p=>p.OldDetail.LoginName)%>
        <%=Html.HiddenFor(p=>p.OldDetail.Name)%>
        <%=Html.HiddenFor(p=>p.OldDetail.QQ)%>
        <%=Html.HiddenFor(p=>p.OldDetail.State)%>
        <%=Html.HiddenFor(p=>p.OldDetail.Tel)%>
        <%=Html.HiddenFor(p=>p.Accout.AddMoney) %>
        <%=Html.HiddenFor(p=>p.Accout.BackMoney) %>
        <%=Html.HiddenFor(p=>p.Accout.BackMoney_Child) %>
        <%=Html.HiddenFor(p=>p.Accout.Balance) %>
        <%=Html.HiddenFor(p=>p.Accout.BuyLottery) %>
        <%=Html.HiddenFor(p=>p.Accout.FreezeMoney) %>
        <%=Html.HiddenFor(p=>p.Accout.TackMoney) %>
        <%=Html.HiddenFor(p=>p.Accout.WinMoney) %>
        <%=Html.HiddenFor(p=>p.Accout.WinMoney_Child) %>
        <% Html.EndForm(); %>
    </fieldset>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
    <style type="text/css">
        .lbl
        {
            float: left;
            width: 120px;
        }
        .lblfreezeMoney_Manage_Detail
        {
            width: 70px;
        }
        .lblbtn
        {
            float: left;
            height: 30px;
            line-height: 30px;
            margin-right: 5px;
        }
        .txtbalance_Manage_Detail
        {
            float: left;
            width: 80px;
        }
        .txtfreezeMoney_Manage_Detail
        {
            float: left;
            width: 80px;
        }
        .link_update
        {
            cursor: pointer;
        }
        .link_save
        {
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        function link_update_Click(obj) {
            var txt1 = $(".txtbalance_Manage_Detail");
            var txt2 = $(".txtfreezeMoney_Manage_Detail");
            var lbl1 = $(".lblbalance_Manage_Detail");
            var lbl2 = $(".lblfreezeMoney_Manage_Detail");
            var link1 = $(obj);
            var link2 = $(".link_save");
            var link3 = $(".link_cancel");
            txt1.show();
            txt2.show();
            link2.show();
            link3.show();

            link1.hide();
            lbl1.hide();
            lbl2.hide();
        }
        function link_save_Click(obj) {
            var txt1 = $(".txtbalance_Manage_Detail");
            var txt2 = $(".txtfreezeMoney_Manage_Detail");
            var lbl1 = $(".lblbalance_Manage_Detail");
            var lbl2 = $(".lblfreezeMoney_Manage_Detail");
            var link1 = $(obj);
            var link2 = $(".link_update");
            var link3 = $(".link_cancel");
            if (txt1.val() == '') {
                alert("请输入余额");
                txt1.focus();
                return;
            }
            if (txt2.val() == '') {
                alert("请输入冻结金额");
                txt2.focus();
                return;
            }
            if (txt1.val() == lbl1.text() && txt2.val() == lbl2.text()) {
                alert("未做修改");
                return;
            }
            var balance = _ParseDouble(txt1.val());
            if (balance == null) {
                alert("余额格式不正确");
                return;
            }
            var freezeMoney = _ParseDouble(txt2.val());
            if (freezeMoney == null) {
                alert("冻结金额不正确");
                return;
            }
            if (!confirm("修改后将出现数据差异。您确定要修改当前用户的金额？")) {
                return;
            }
            var p = {
                Uid: '<%=Model.Uid %>',
                OldBalance: lbl1.text(),
                OldFreezeMoney: lbl2.text(),
                NewBalance: balance,
                NewFreezeMoney: freezeMoney
            };
            getJSON('<%=Url.Action("UpdateMoney") %>', p, function (data) {
                if (data.count >= 0) {
                    lbl1.text(balance);
                    lbl2.text(freezeMoney);
                    var hide1 = $("#Accout_Balance");
                    var hide2 = $("#Accout_FreezeMoney");
                    hide1.val(balance);
                    hide2.val(freezeMoney);
                    if (data.count == 0) {
                        alert("未做修改");
                    } else {
                        alert("修改成功！");
                    }
                    txt1.hide();
                    txt2.hide();
                    link1.hide();
                    link3.hide();

                    link2.show();
                    lbl1.show();
                    lbl2.show();

                }
                else {
                    alert("修改失败！");
                }

            });
        }
        function link_cancel_Click(obj) {
            var txt1 = $(".txtbalance_Manage_Detail");
            var txt2 = $(".txtfreezeMoney_Manage_Detail");
            var lbl1 = $(".lblbalance_Manage_Detail");
            var lbl2 = $(".lblfreezeMoney_Manage_Detail");
            var link1 = $(obj);
            var link2 = $(".link_update");
            var link3 = $(".link_save");
            txt1.hide();
            txt2.hide();
            link1.hide();
            link3.hide();

            link2.show();
            lbl1.show();
            lbl2.show();
        }
    </script>
</asp:Content>
